<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>08_形参默认值Default Arguments</title>
</head>
<body>
<!--
    * 形参的默认值----当不传入参数的时候，默认使用形参里的默认值
    function Point(x = 1,y = 2) {
			this.x = x;
			this.y = y;
    }
-->
<script type="text/javascript">
	//es5
	function multiply(a,b){
		a=a||5;
		b=b||3;
		return a*b;
	}
	var multiply=multiply(undefined,4);
	console.log(multiply);//20
	
	
	// es6
	function Point(x=12, y=12) {
		this.x = x;
		this.y = y;
	}
	let p = new Point();
	console.log(p);//Point {x: 12, y: 12}
	
	let point = new Point(25, 36);
	console.log(point);//Point {x: 25, y: 36}
</script>

</body>
</html>